<template>
	<view class="good-list">
		<view class="good-li" v-for="(item,i) in list" :key="i">
			<image class="good-img" mode="widthFix" :src="item.goodImg"></image>
			<view class="item">
				<view class="title" @click="find(i)">{{item.goodName}}</view>
				<view style="display: flex;">
					<view class="price">{{item.goodPrice}}元</view>
					<view class="sold">已售{{item.goodSold}}件</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "good-list",
		data() {
			return {

			};
		},
		methods: {
			find(i) {
				console.log(i);
				uni.navigateTo({
					url: '/pages/ details/ details?index=' + i
				})
			}
		},
		props: {
			list: {
				type: Array,
				default () {
					return []
				}
			}
		}
	}
</script>

<style lang="scss">
	.good-list {
		background-color: #fff;

		.good-li {
			display: flex;
			align-items: center;
			padding: 20px;
			border-bottom: 1px solid #eee;

			.good-img {
				width: 160upx;
				height: 160upx;
				margin-right: 20rpx;
			}

			.item {
				flex: 1;

				.title {
					font-size: 26px;
					line-height: 40px;
					height: 80px;
					margin-bottom: 20px;
					overflow: hidden;
				}

				.price {
					font-size: 26px;
					color: red;
				}

				.sold {
					font-size: 24px;
					margin-left: 16px;
					color: gray;
				}
			}
		}
	}
</style>